package com.example.mapper;

import com.example.pojo.Detail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.vo.DetailVo;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lyj
 * @since 2023-02-20
 */
public interface DetailMapper extends BaseMapper<Detail> {

    @Select("select wt.name wasteTypeName,\n" +
            "wt.code wasteTypeCode,\n" +
            "w.code wasteCode,\n" +
            "w.name wasteName,\n" +
            "d.*\n" +
            "from detail d \n" +
            "left join waste_type wt on d.waste_type_id=wt.id\n" +
            "left join waste w on d.waste_id=w.id\n" +
            "where d.del_flag=0\n" +
            "and d.work_order_id=#{id}")
    DetailVo queryByWorkOrderId(Long id);
}
